// -*- Mode: C++ -*-
/*++

Copyright (c) 1998 Microsoft Corporation

Abstract:

    Interface definitions for TIME components

--*/

#include "datimeid.h"
import "servprov.idl";

cpp_quote("#include <olectl.h>")
cpp_quote("#include \"danim.h\"")

interface ITIMEElementCollection;

[
    uuid(33adbfcc-3e0d-11d2-b948-00c04fa32195),
    lcid(0x0000),
    version(1.0)
]
library TIME
{

typedef enum _MediaType
{
    MT_Media,
    MT_Image,
    MT_Audio,
    MT_Video,
    MT_Animation,
    MT_Textstream
}MediaType;

    importlib("STDOLE32.TLB");
    
    #include <olectl.h>

    [
        object,
        uuid(e53dc05c-3f93-11d2-b948-00c04fa32195),
        dual,
        pointer_default(unique)
    ]
    interface ITIMEElement : IDispatch
    {
        [propget, id(DISPID_TIMEELEMENT_BEGIN)] HRESULT begin([out, retval] VARIANT * time);
        [propput, id(DISPID_TIMEELEMENT_BEGIN)] HRESULT begin([in] VARIANT time);

        [propget, id(DISPID_TIMEELEMENT_BEGINWITH)] HRESULT beginWith([out, retval] VARIANT * time);
        [propput, id(DISPID_TIMEELEMENT_BEGINWITH)] HRESULT beginWith([in] VARIANT time);

        [propget, id(DISPID_TIMEELEMENT_BEGINAFTER)] HRESULT beginAfter([out, retval] VARIANT * time);
        [propput, id(DISPID_TIMEELEMENT_BEGINAFTER)] HRESULT beginAfter([in] VARIANT time);

        [propget, id(DISPID_TIMEELEMENT_BEGINEVENT)] HRESULT beginEvent([out, retval] VARIANT * time);
        [propput, id(DISPID_TIMEELEMENT_BEGINEVENT)] HRESULT beginEvent([in] VARIANT time);

        [propget, id(DISPID_TIMEELEMENT_DUR)] HRESULT dur([out, retval] VARIANT * time);
        [propput, id(DISPID_TIMEELEMENT_DUR)] HRESULT dur([in] VARIANT time);

        [propget, id(DISPID_TIMEELEMENT_END)] HRESULT end([out, retval] VARIANT * time);
        [propput, id(DISPID_TIMEELEMENT_END)] HRESULT end([in] VARIANT time);

        [propget, id(DISPID_TIMEELEMENT_ENDWITH)] HRESULT endWith([out, retval] VARIANT * time);
        [propput, id(DISPID_TIMEELEMENT_ENDWITH)] HRESULT endWith([in] VARIANT time);

        [propget, id(DISPID_TIMEELEMENT_ENDEVENT)] HRESULT endEvent([out, retval] VARIANT * time);
        [propput, id(DISPID_TIMEELEMENT_ENDEVENT)] HRESULT endEvent([in] VARIANT time);

        [propget, id(DISPID_TIMEELEMENT_ENDSYNC)] HRESULT endSync([out, retval] VARIANT * time);
        [propput, id(DISPID_TIMEELEMENT_ENDSYNC)] HRESULT endSync([in] VARIANT time);

        [propget, id(DISPID_TIMEELEMENT_REPEAT)] HRESULT repeat([out, retval] VARIANT * time);
        [propput, id(DISPID_TIMEELEMENT_REPEAT)] HRESULT repeat([in] VARIANT time);

        [propget, id(DISPID_TIMEELEMENT_REPEATDUR)] HRESULT repeatDur([out, retval] VARIANT * time);
        [propput, id(DISPID_TIMEELEMENT_REPEATDUR)] HRESULT repeatDur([in] VARIANT time);

        [propget, id(DISPID_TIMEELEMENT_ACCELERATE)] HRESULT accelerate([out, retval] int * );
        [propput, id(DISPID_TIMEELEMENT_ACCELERATE)] HRESULT accelerate([in] int );

        [propget, id(DISPID_TIMEELEMENT_DECELERATE)] HRESULT decelerate([out, retval] int * );
        [propput, id(DISPID_TIMEELEMENT_DECELERATE)] HRESULT decelerate([in] int );

        [propget, id(DISPID_TIMEELEMENT_ENDHOLD)] HRESULT endHold([out, retval] VARIANT_BOOL *);
        [propput, id(DISPID_TIMEELEMENT_ENDHOLD)] HRESULT endHold([in] VARIANT_BOOL );

        [propget, id(DISPID_TIMEELEMENT_AUTOREVERSE)] HRESULT autoReverse([out, retval] VARIANT_BOOL *);
        [propput, id(DISPID_TIMEELEMENT_AUTOREVERSE)] HRESULT autoReverse([in] VARIANT_BOOL );

        [propget, id(DISPID_TIMEELEMENT_EVENTRESTART)] HRESULT eventRestart([out, retval] VARIANT_BOOL *);
        [propput, id(DISPID_TIMEELEMENT_EVENTRESTART)] HRESULT eventRestart([in] VARIANT_BOOL );

        [propget, id(DISPID_TIMEELEMENT_TIMEACTION)] HRESULT timeAction([out, retval] BSTR * time);
        [propput, id(DISPID_TIMEELEMENT_TIMEACTION)] HRESULT timeAction([in] BSTR time);

        [id (DISPID_TIMEELEMENT_BEGINELEMENT)] HRESULT beginElement();
        [id (DISPID_TIMEELEMENT_ENDELEMENT)] HRESULT endElement();
        [id (DISPID_TIMEELEMENT_PAUSE)] HRESULT pause();
        [id (DISPID_TIMEELEMENT_RESUME)] HRESULT resume();
        [id (DISPID_TIMEELEMENT_CUE)] HRESULT cue();

        [propget, id(DISPID_TIMEELEMENT_TIMELINE)] HRESULT timeline([out, retval] BSTR *);
        [propput, id(DISPID_TIMEELEMENT_TIMELINE)] HRESULT timeline([in] BSTR );

        [propget, id(DISPID_TIMEELEMENT_CURRTIME)] HRESULT currTime([out, retval] float * time);
        [propput, id(DISPID_TIMEELEMENT_CURRTIME)] HRESULT currTime([in] float time);

        [propget, id(DISPID_TIMEELEMENT_LOCALTIME)] HRESULT localTime([out, retval] float * time);
        [propput, id(DISPID_TIMEELEMENT_LOCALTIME)] HRESULT localTime([in] float time);

        [propget, id(DISPID_TIMEELEMENT_CURRSTATE)] HRESULT currState([out, retval] BSTR * state);

        [propget, id(DISPID_TIMEELEMENT_SYNCBEHAVIOR)] HRESULT syncBehavior([out, retval] BSTR * sync);
        [propput, id(DISPID_TIMEELEMENT_SYNCBEHAVIOR)] HRESULT syncBehavior([in] BSTR sync);

        [propget, id(DISPID_TIMEELEMENT_SYNCTOLERANCE)] HRESULT syncTolerance([out, retval] VARIANT * tol);
        [propput, id(DISPID_TIMEELEMENT_SYNCTOLERANCE)] HRESULT syncTolerance([in] VARIANT tol);

        [propget, id(DISPID_TIMEELEMENT_PARENTTIMEELEMENT)] HRESULT parentTIMEElement([out, retval] ITIMEElement ** parent);
        [propput, id(DISPID_TIMEELEMENT_PARENTTIMEELEMENT)] HRESULT parentTIMEElement([in] ITIMEElement * parent);

        //
        // Collections
        //
        [propget, id(DISPID_TIMEELEMENT_ALLTIMEELEMENTS)]
        HRESULT allTIMEElements([out, retval] ITIMEElementCollection **ppDisp);
        [propget, id(DISPID_TIMEELEMENT_CHILDRENTIMEELEMENTS)]
        HRESULT childrenTIMEElements([out, retval] ITIMEElementCollection **ppDisp);
        [propget, id(DISPID_TIMEELEMENT_ALLTIMEINTERFACES), restricted]
        HRESULT allTIMEInterfaces([out, retval] ITIMEElementCollection **ppDisp);
        [propget, id(DISPID_TIMEELEMENT_CHILDRENTIMEINTERFACES), restricted]
        HRESULT childrenTIMEInterfaces([out, retval] ITIMEElementCollection **ppDisp);

        //
        // DirectAnimation behaviors
        //
        
        [propget, id(DISPID_TIMEELEMENT_TIMELINEBEHAVIOR)]
        HRESULT timelineBehavior([out, retval] IDispatch ** bvr);
        
        [propget, id(DISPID_TIMEELEMENT_PROGRESSBEHAVIOR)]
        HRESULT progressBehavior([out, retval] IDispatch ** bvr);
        
        [propget, id(DISPID_TIMEELEMENT_ONOFFBEHAVIOR)]
        HRESULT onOffBehavior([out, retval] IDispatch ** bvr);
    };

    //
    // ITIMEDAElement
    //
    
    [
        object,
        uuid(7a6af9a0-9355-11d2-80ba-00c04fa32195),
        pointer_default(unique)
    ]
    interface ITIMEDAElementRenderSite : IUnknown
    {
        HRESULT Invalidate(LPRECT prc);
    }

    [
        object,
        uuid(9e328494-9354-11d2-80ba-00c04fa32195),
        pointer_default(unique)
    ]
    interface ITIMEDAElementRender : IUnknown
    {
        HRESULT Tick();
        HRESULT Draw(HDC dc, LPRECT prc);

        [propget] HRESULT RenderSite([out, retval] ITIMEDAElementRenderSite ** ppSite);
        [propput] HRESULT RenderSite([in] ITIMEDAElementRenderSite * pSite);
    };

    [
        object,
        uuid(17c7a570-4d53-11d2-b954-00c04fa32195),
        dual,
        pointer_default(unique)
    ]
    interface ITIMEDAElement : IDispatch
    {
        [propget, id(DISPID_TIMEDAELEMENT_IMAGE)] HRESULT image([out, retval] VARIANT * img);
        [propput, id(DISPID_TIMEDAELEMENT_IMAGE)] HRESULT image([in] VARIANT img);

        [propget, id(DISPID_TIMEDAELEMENT_SOUND)] HRESULT sound([out, retval] VARIANT * snd);
        [propput, id(DISPID_TIMEDAELEMENT_SOUND)] HRESULT sound([in] VARIANT snd);

        [propget, id(DISPID_TIMEDAELEMENT_RENDERMODE)] HRESULT renderMode([out, retval] VARIANT * mode);
        [propput, id(DISPID_TIMEDAELEMENT_RENDERMODE)] HRESULT renderMode([in] VARIANT mode);

        [id(DISPID_TIMEDAELEMENT_ADDDABEHAVIOR)]
        HRESULT addDABehavior([in] VARIANT bvr,
                              [out, retval] LONG * cookie);

        [id(DISPID_TIMEDAELEMENT_REMOVEDABEHAVIOR)]
        HRESULT removeDABehavior([in] LONG cookie);
        
        [propget, id(DISPID_TIMEDAELEMENT_STATICS)] 
        HRESULT statics([out, retval] IDispatch ** ppStatics);

        [propget, id(DISPID_TIMEDAELEMENT_RENDEROBJECT)] 
        HRESULT renderObject([out, retval] ITIMEDAElementRender ** );
    };

    //
    // ITIMEBodyElement
    //
    
    [
        object,
        uuid(111c45f0-4de9-11d2-b954-00c04fa32195),
        dual,
        pointer_default(unique)
    ]
    interface ITIMEBodyElement : ITIMEElement
    {
        [propget, id(DISPID_TIMEBODYELEMENT_TIMESTARTRULE)] HRESULT timeStartRule([out, retval] BSTR * startrule);
        [propput, id(DISPID_TIMEBODYELEMENT_TIMESTARTRULE)] HRESULT timeStartRule([in] BSTR startrule);

        [id(DISPID_TIMEBODYELEMENT_ADDTIMEDAELEMENT)] HRESULT addTIMEDAElement([in] ITIMEDAElement * daelm);
        [id(DISPID_TIMEBODYELEMENT_REMOVETIMEDAELEMENT)] HRESULT removeTIMEDAElement([in] ITIMEDAElement * daelm);
    };

    [
        object,
        uuid(68675562-53ab-11d2-b955-3078302c2030),
        dual,
        pointer_default(unique)
    ]
    interface ITIMEMediaElement : ITIMEElement
    {
        [propget, id(DISPID_TIMEMEDIAELEMENT_SRC)] HRESULT src([out, retval] VARIANT * url);
        [propput, id(DISPID_TIMEMEDIAELEMENT_SRC)] HRESULT src([in] VARIANT url);

        [propget, id(DISPID_TIMEMEDIAELEMENT_IMG)] HRESULT img([out, retval] VARIANT * url);
        [propput, id(DISPID_TIMEMEDIAELEMENT_IMG)] HRESULT img([in] VARIANT url);

        [propget, id(DISPID_TIMEMEDIAELEMENT_PLAYER)] HRESULT player([out, retval] VARIANT * clsid);
        [propput, id(DISPID_TIMEMEDIAELEMENT_PLAYER)] HRESULT player([in] VARIANT clsid);

        [propget, id(DISPID_TIMEMEDIAELEMENT_SRCTYPE)] HRESULT type([out, retval] VARIANT * type);
        [propput, id(DISPID_TIMEMEDIAELEMENT_SRCTYPE)] HRESULT type([in] VARIANT type);
 
        [propget, id(DISPID_TIMEMEDIAELEMENT_PLAYEROBJECT)] HRESULT playerObject([out, retval] IDispatch **ppDisp);

        [propget, id(DISPID_TIMEMEDIAELEMENT_CLOCKSOURCE)] HRESULT clockSource([out, retval] VARIANT_BOOL * b);
        [propput, id(DISPID_TIMEMEDIAELEMENT_CLOCKSOURCE)] HRESULT clockSource([in] VARIANT_BOOL b);

        [propget, id(DISPID_TIMEMEDIAELEMENT_CLIPBEGIN)] HRESULT clipBegin([out, retval] VARIANT * type);
        [propput, id(DISPID_TIMEMEDIAELEMENT_CLIPBEGIN)] HRESULT clipBegin([in] VARIANT type);

        [propget, id(DISPID_TIMEMEDIAELEMENT_CLIPEND)] HRESULT clipEnd([out, retval] VARIANT * type);
        [propput, id(DISPID_TIMEMEDIAELEMENT_CLIPEND)] HRESULT clipEnd([in] VARIANT type);
    };

    [
        object,
        uuid(423e9da4-3e0d-11d2-b948-00c04fa32195),
        dual,
        hidden,
        pointer_default(unique)
    ]
    interface ITIMEFactory : IDispatch
    {
        [id(DISPID_TIMEFACTORY_CREATETIMEELEMENT)] HRESULT CreateTIMEElement([in] REFIID riid, [in] IUnknown *pUnk, [out, retval] void ** timeelm);
        [id(DISPID_TIMEFACTORY_CREATETIMEELEMENTBODY)] HRESULT CreateTIMEBodyElement([in] REFIID riid, [out, retval] void ** timeelm);
        [id(DISPID_TIMEFACTORY_CREATETIMEDAELEMENT)] HRESULT CreateTIMEDAElement([in] REFIID riid, [out, retval] void ** timeelm);
        [id(DISPID_TIMEFACTORY_CREATETIMEMEDIAELEMENT)] HRESULT CreateTIMEMediaElement([in] REFIID riid, [in] MediaType type, [out, retval] void ** timeelm);
    }

    [
        odl,
        oleautomation,
        dual,
        uuid(1C00BC3A-5E1C-11d2-B252-00A0C90D6111),
    ]
    interface ITIMEElementCollection : IDispatch
    {
        [propput, id(DISPID_TIMEELEMENTCOLLECTION_LENGTH)]
        HRESULT length([in] long v);
        [propget, id(DISPID_TIMEELEMENTCOLLECTION_LENGTH)]
        HRESULT length([retval, out] long * p);
        [propget, id(DISPID_TIMEELEMENTCOLLECTION__NEWENUM), restricted, hidden]
        HRESULT _newEnum([retval, out] IUnknown** ppIUnknown);
        [id(DISPID_TIMEELEMENTCOLLECTION_ITEM)]
        HRESULT item([optional, in] VARIANT varName,[optional, in] VARIANT varIndex,[retval, out] IDispatch** ppDisp);
        [id(DISPID_TIMEELEMENTCOLLECTION_TAGS)]
        HRESULT tags([in] VARIANT varName, [retval, out] IDispatch** ppDisp);
    };

    [
        odl,
        oleautomation,
        dual,
        uuid(E6FAA0B2-69FE-11d2-B259-00A0C90D6111),
    ]
    interface ITIMEMediaPlayer : IDispatch
    {
        [id(DISPID_TIMEMEDIAPLAYER_INIT)]
        HRESULT Init();

        [id(DISPID_TIMEMEDIAPLAYER_CLIPBEGIN)]
        HRESULT clipBegin([in] VARIANT varClipBegin);
        [id(DISPID_TIMEMEDIAPLAYER_CLIPEND)]
        HRESULT clipEnd([in] VARIANT varClipEnd);

        [id(DISPID_TIMEMEDIAPLAYER_BEGIN)]
        HRESULT begin();
        [id(DISPID_TIMEMEDIAPLAYER_END)]
        HRESULT end();

        [id(DISPID_TIMEMEDIAPLAYER_RESUME)]
        HRESULT resume();
        [id(DISPID_TIMEMEDIAPLAYER_PAUSE)]
        HRESULT pause();

        [id(DISPID_TIMEMEDIAPLAYER_TICK)]
        HRESULT tick();

        [propput, id(DISPID_TIMEMEDIAPLAYER_CURRENTTIME)]
        HRESULT CurrentTime([in] double dblCurrentTime);
        [propget, id(DISPID_TIMEMEDIAPLAYER_CURRENTTIME)]
        HRESULT CurrentTime([out, retval] double *dblCurrentTime);

        [propput, id(DISPID_TIMEMEDIAPLAYER_SRC)]
        HRESULT src([in] BSTR bstrURL);
        [propget, id(DISPID_TIMEMEDIAPLAYER_SRC)]
        HRESULT src([retval, out] BSTR *pbstrURL);

        [propput, id(DISPID_TIMEMEDIAPLAYER_REPEAT)]
        HRESULT repeat([in] long ltime);
        [propget, id(DISPID_TIMEMEDIAPLAYER_REPEAT)]
        HRESULT repeat([retval, out] long *ltime);

        [id(DISPID_TIMEMEDIAPLAYER_CUE)]
        HRESULT cue();
    };

    [
        hidden,
        uuid(4539E412-7813-11d2-B25F-00A0C90D6111)
    ]
    dispinterface TIMEMediaPlayerEvents
    {
        properties:
        methods:
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONBEGIN)]            void onbegin();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONEND)]              void onend();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONRESUME)]           void onresume();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONPAUSE)]            void onpause();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONMEDIAREADY)]       void onmediaready();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONMEDIASLIP)]        void onmediaslip();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONMEDIALOADFAILED)]  void onmedialoadfailed();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_READYSTATECHANGE)]   void onreadystatechange(long readystate);
    };

    [
        object,
        uuid(73BA8F8A-80E0-11d2-B263-00A0C90D6111),
        dual,
        hidden,
        pointer_default(unique)
    ]
    interface ITIMEMMFactory : IDispatch
    {
        HRESULT CreateBehavior([in] BSTR id,
                               [in] IDispatch *bvr,
                               [out, retval] IUnknown **ppOut);
        HRESULT CreateTimeline([in] BSTR id,
                               [out, retval] IUnknown **ppOut);
        HRESULT CreatePlayer([in] BSTR id,
                             [in] IUnknown * bvr,
                             [in] IServiceProvider * sp,
                             [out, retval] IUnknown **ppOut);
        HRESULT CreateView([in] BSTR id,
                           [in] IDispatch * imgbvr,
                           [in] IDispatch * sndbvr,
                           [in] IUnknown * viewsite,
                           [out, retval] IUnknown **ppOut);
    }

    [
        uuid(33FDA1EA-80DF-11d2-B263-00A0C90D6111)
    ]
    coclass TIMEMMFactory
    {
        [default] interface ITIMEMMFactory;
    };

    [
        uuid(476c391c-3e0d-11d2-b948-00c04fa32195)
    ]
    coclass TIMEFactory
    {
        [default] interface ITIMEFactory;
    };
}
